home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / scrtst / frmmain.frm < prev    next >
Text File  |  1995-01-24  |  2KB  |  95 lines

  1. VERSION 2.00
  2. Begin Form frmMain 
  3.    BackColor       =   &H00000000&
  4.    BorderStyle     =   0  'None
  5.    Caption         =   "Screen Tester"
  6.    ClientHeight    =   7200
  7.    ClientLeft      =   915
  8.    ClientTop       =   2790
  9.    ClientWidth     =   9600
  10.    Height          =   7605
  11.    Icon            =   FRMMAIN.FRX:0000
  12.    KeyPreview      =   -1  'True
  13.    Left            =   855
  14.    LinkTopic       =   "Form1"
  15.    MaxButton       =   0   'False
  16.    ScaleHeight     =   7200
  17.    ScaleWidth      =   9600
  18.    Top             =   2445
  19.    Width           =   9720
  20. End
  21. Option Explicit
  22.  
  23. Sub Form_KeyDown (KeyCode As Integer, Shift As Integer)
  24.   '
  25.   ' Move form around by keyboard -- Exit program on ALT-F4
  26.   '
  27.   Select Case KeyCode
  28.     Case KEY_HOME
  29.       Me.Top = 0
  30.       Me.Left = 0
  31.     Case KEY_LEFT, KEY_UP, KEY_RIGHT, KEY_DOWN
  32.       MoveForm Me
  33.     Case KEY_F4
  34.       If Shift = ALT_MASK Then
  35.         ExitProgram
  36.       End If
  37.     Case Else
  38.       '
  39.       ' Do Nothing
  40.       '
  41.   End Select
  42. End Sub
  43.  
  44. Sub Form_Load ()
  45.   SetUpForm Me, "Main"
  46. End Sub
  47.  
  48. Sub Form_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  49.   Dim uPoint As POINTAPI
  50.   Dim uConvert As ConvertPOINTAPI
  51.   Dim r As Integer
  52.   If Button = KEY_LBUTTON Then
  53.     '
  54.     ' Move Window on Left Mouse Down
  55.     '
  56.     ' Further information on this method is available in the following
  57.     ' Microsoft Knowledge Base article.
  58.     '
  59.     '   How to Move a Form that Has No Titlebar or Caption
  60.     '   Article ID: Q114593
  61.     '
  62.     Call GetCursorPos(uPoint)
  63.     LSet uConvert = uPoint
  64.     '
  65.     ' Send LButtonUp to finish the impending LButtonDown.
  66.     ' This line of code will invoke the Form_MouseUp() event,
  67.     ' so be careful what code you place in that event
  68.     '
  69.     r = SendmessageByNum(Me.hWnd, WM_LBUTTONUP, 0, uConvert.xy)
  70.     '
  71.     ' Now tell the form someone is clicking the window caption
  72.     '
  73.     r = SendmessageByNum(Me.hWnd, WM_SYSCOMMAND, MOUSE_MOVE, uConvert.xy)
  74.     '
  75.     ' Save position for .INI file after move is completed
  76.     '
  77.     SaveScreenPosition
  78.   ElseIf Button = KEY_RBUTTON Then
  79.     '
  80.     ' Popup menu on Right Mouse Down
  81.     '
  82.     frmUtility.PopupMenu frmUtility.mnuPopup
  83.   End If
  84. End Sub
  85.  
  86. Sub Form_QueryUnload (Cancel As Integer, UnloadMode As Integer)
  87.   '
  88.   ' Insure clean exit when unload is generated from outside of the program
  89.   '
  90.   If UnloadMode <> 1 Then
  91.     ExitProgram
  92.   End If
  93. End Sub
  94.  
  95.